package com.demo;

public class StringDemo13 {
    public static void main(String[] args) {
        //1.获取发言
        String talk = "cao，TMD你玩的真好，SB以后不要再玩了，WDNMD。";
        //2.定义敏感词库
        String[] arr = {"TMD", "CNM", "SB", "MLGB", "WDNMD", "cao" };
        //3.循环得到数组中的每一个敏感词，依次进行替换
        for (int i = 0; i < arr.length; i++) {
            //3.替换敏感词
            talk = talk.replace(arr[i], "***");
        }
        //4.打印结果
        System.out.println(talk);
    }

}
